package com.quanyan.place.enums;

import com.quanyan.common.enums.BaseEnum;

import java.util.HashSet;
import java.util.Set;

/**
 * 场馆下单优惠方式
 */
public enum PreferentialWayEnum implements BaseEnum {
    PREFERENTIAL_WAY_EGG(7, "7", "鸟蛋" ),
    PREFERENTIAL_WAY_MEMBER_CARD(10, "10", "会员卡" ),
    PREFERENTIAL_WAY_MEMBER_COUPON(11, "11", "优惠券" ),
    ;
    protected int id;

    protected String code;

    protected String label;


    PreferentialWayEnum(int id, String code, String label) {
        this.id = id;
        this.code = code;
        this.label = label;
    }


    @Override
    public int getId() {
        return id;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getLabel() {
        return label;
    }

    @Override
    public boolean isSuccess() {
        return true;
    }

    /**
     * 描述：返回指定id的Enum
     * @param id
     * @return
     */
    public static PreferentialWayEnum getEnum(int id){
        for (PreferentialWayEnum tmpEnum : PreferentialWayEnum.values()) {
            if(tmpEnum.getId() == id)
                return tmpEnum;
        }
        return null;
    }

    public static Set<Integer> getPreferentialWaySet(){
        Set<Integer> PreferentialWaySet = new HashSet<Integer>();
        for (PreferentialWayEnum tmpEnum : PreferentialWayEnum.values()) {
            PreferentialWaySet.add(tmpEnum.getId());
        }
        return PreferentialWaySet;
    }

}
